package com.tsit.study.common.dubbo.config;

import org.apache.dubbo.config.ConsumerConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author wangxuzhi
 * @date 2020/11/18 9:45
 */
@Configuration
public class DubboConfig {

    /**
     * 解决 dubbo 服务消费者在服务提供者未启动的情况下不能成功启动的问题
     */
    @Bean
    public ConsumerConfig consumerConfig() {
        ConsumerConfig consumerConfig = new ConsumerConfig();
        consumerConfig.setCheck(false);
        consumerConfig.setTimeout(20000);
        consumerConfig.setLazy(true);
        return consumerConfig;
    }
}
